from nativePlugins.fuckAdvertising.fuckAdvertising import *

class PureYouTubeFilter(fuckAdvertisingFilter):
    def __init__(self):
        super()

    def allowRequest(self, netinfo):
        url = netinfo.getURL()
        domain = netinfo.getDomain()
        if str(url).startswith("https://www.youtube.com/api/stats/") \
                or str(url).__contains__("doubleclick.net") or domain == "adservice.google.com" \
                or str(url).__contains__("www.youtube.com/ptracking") \
                or str(url).__contains__("www.youtube.com/get_midroll_info") \
                or str(url).__contains__("www.youtube.com/pagead/") \
                or str(url).__contains__("www.youtube.com/youtubei/v1/log_event") \
                or str(url).__contains__("www.youtube.com/pcs/activeview") \
                or str(url).__contains__("www.youtube.com/youtubei/v1/feedback") \
                or str(url).__contains__("www.googleadservices.com/pagead/") \
                or str(url).__contains__("www.youtube.com/player_204"):
            return False
        return True
    #               or str(url).__contains__("www.youtube.com/youtubei/v1/") \

    def getName(self):
        return "fuckAdvertising: PureYouTube"

PureYouTubeFilter_INSTANCE = PureYouTubeFilter()